package demo;

public class InterruptDemo {

    static class SubThread extends Thread{

        @Override
        public void run() {
            while(true){
                System.out.println("A");
                boolean interrupted=Thread.interrupted();
                if(interrupted){
                    break;

                }

            }
        }
    }

    public static void main(String[] args) {

        SubThread subThread=new SubThread();
        subThread.start();
        subThread.interrupt();

    }
}
